import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'
import WujieVue from 'wujie-vue3'

const { VITE_APP_BASE_URL } = import.meta.env

const router = createRouter({
    history: createWebHistory(VITE_APP_BASE_URL),
    routes: [
        {
            path: '',
            component: Home,
            children: [
                {
                    path: '/proa/:path',
                    component: () => import('../views/Proa.vue'),
                    meta: { doCache: '1' },
                },
                {
                    path: '/prob/:path',
                    component: () => import('../views/Prob.vue'),
                    meta: { doCache: '1' },
                },
            ],
        },
    ],
})
// 监听路由变化，发送事件
const { bus } = WujieVue
router.afterEach(to => {
    // bus.$emit('main-route-change', to.fullPath)
})

export default router
